Promise.prototype.allSettled = function(array){
  let result = []
  return new Promise((resolve,reject)=>{
    array.forEach((p,i)=>{
      Promise.resolve(p).then((value)=>{
        result.push({
          status:'fulfilled',
          value:value
        })
        if(result.length === array.length){
          resolve(result)
        }
      },(reason)=>{
        result.push({
          status:'rejected',
          reason:reason
        })
        if(result.length === array.length){
          resolve(result)
        }
      })
    })
  })
}